// const BASE_URL = "http://39.99.247.58:9802"
export const myRequest = (options) => {
	return new Promise((resolve, reject) => {
		uni.request({
			url: options.url,
			method: options.method || 'GET',
			data: options.data || {},
			header: options.header || {
				token: uni.getStorageSync('token')
			},
			success: (res) => {
				console.log(res)
				if (res.statusCode != 200) {
					return uni.showToast({
						title: "请求数据失败",
						icon: 'error'
					})
				}
				//调用resolve把res传出去
				resolve(res);
			},
			fail: (err) => {
				uni.showToast({
					title: "请求数据失败",
					icon: 'error'
				});
				reject(err)
			}
		})
	})
}
